package com.woniuxy.controller;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.page.TableDataInfo;
import com.woniuxy.entity.BeforeQueryData;
import com.woniuxy.entity.LoanApply;
import com.woniuxy.entity.UserYewuDate;
import com.woniuxy.service.LoanApprovalService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @description: TODO 贷中
 * @author jx
 * @date 2022/9/22 11:50
 * @version 1.0
 */
@RestController
@RequestMapping("/LoanApproval")
public class LoanApprovalController extends BaseController {
    @Autowired
    LoanApprovalService loanApprovalService;
    //放款处理list
    @GetMapping("/list")
    @ResponseBody
    public TableDataInfo list(){
        startPage();
        List<UserYewuDate> list = loanApprovalService.selectLoanApprovalList();
        return getDataTable(list);
    }

    //动态条件查询
    @PostMapping("/query")
    @ResponseBody
    public TableDataInfo queryByCondition(@RequestBody BeforeQueryData datas){
        startPage();
        if(datas.getDates()!=null) {
            if (datas.getDates().length == 0) {
                datas.setDates(null);
            }
        }
        System.out.println(datas);
        List<UserYewuDate> list = loanApprovalService.queryByCondition(datas);
        return getDataTable(list);
    }


    //放款审核list
    @GetMapping("/loanDealList")
    @ResponseBody
    public TableDataInfo loanDealList(){
        startPage();
        List<UserYewuDate> list = loanApprovalService.selectLoanDealList();
        return getDataTable(list);
    }

    //动态条件查询
    @PostMapping("/loanDealQuery")
    @ResponseBody
    public TableDataInfo loanDealQuery(@RequestBody BeforeQueryData datas){
        startPage();
        if(datas.getDates()!=null) {
            if (datas.getDates().length == 0) {
                datas.setDates(null);
            }
        }
        System.out.println(datas);
        List<UserYewuDate> list = loanApprovalService.loanDealQuery(datas);
        return getDataTable(list);
    }
}
